home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2002 #9 / K-CD-9-2002.ISO / Freedom Force / data1.cab / System_Files / sound.py < prev    next >
Encoding:
Python Source  |  2002-03-21  |  1.0 KB  |  50 lines

  1. #
  2. # SoundHandle python class wrappers
  3. # Author: Glenn "Gaffer" Fiedler
  4. # (10 out of 10 for cuteness =p)
  5. #
  6.  
  7. import js
  8.  
  9.  
  10. class Sound:
  11.  
  12.     def __init__(self, name):
  13.         self.handle = js.Sound_CreateSound_HANDLE(name)
  14.  
  15.     def play(self):
  16.         return js.Sound_PlaySound_HANDLE(self.handle)
  17.  
  18.     def loop(self):
  19.         return js.Sound_LoopSound_HANDLE(self.handle)
  20.  
  21.     def endloop(self):
  22.         return js.Sound_EndLoopSound_HANDLE(self.handle)
  23.  
  24.     def position(self, tuple):
  25.         return js.Sound_SetSoundPosition_HANDLE(self.handle, tuple)
  26.  
  27.     def velocity(self, tuple):
  28.         return js.Sound_SetSoundPosition_HANDLE(self.handle, tuple)
  29.  
  30.     def volume(self, gain):
  31.         return js.Sound_SetSoundGain_HANDLE(self.handle, gain)
  32.  
  33.     def playing(self):
  34.         return js.Sound_IsSoundPlaying_HANDLE(self.handle)
  35.  
  36.     def stop(self):
  37.         return js.Sound_StopSound_HANDLE(self.handle)
  38.  
  39.     def release(self):
  40.         return js.Sound_ReleaseSound_HANDLE(self.handle)
  41.  
  42.     def debug(self):
  43.         print self.handle[0]
  44.         print self.handle[1]
  45.  
  46.  
  47.  
  48. def load(name):
  49.     return Sound(name)
  50.